package jn.chen.utils.interfaceController.util;

import jn.chen.utils.interfaceController.domain.User;
import lombok.Data;

/**
 * @className: R
 * @author: chenLin
 * @version: 1.0.0
 * @description:
 * @date: 24/1/15 015 14:48
 */
@Data
public class R<T> implements java.io.Serializable {

    private int code;
    private boolean success;
    private T data;
    private String msg;

    private R(int code,T data, String msg) {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }

    public static <T> R<T> ok(T data) {
        return new R<T>(200,data, null);
    }

    public static <T> R<T> error(String msg) {
        return new R<T>(500,null, msg);
    }
}
